package com.dddd.blog.blogpost;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dddd.blog.api.post.pojo.Post;
import com.dddd.blog.blogpost.mapper.PostMapper;
import com.dddd.blog.blogpost.service.IPostService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.test.context.junit4.SpringRunner;

@SpringBootTest
@RunWith(SpringRunner.class)
@ComponentScan(value = {"com.dddd.blog.blogcommon.*","com.dddd.blog.blogpost"})
@MapperScan("com.dddd.blog.blogpost.mapper")
public class BlogPostTest01 {

    @Autowired
    private PostMapper postMapper;

    @Autowired
    private IPostService postService;

    @Test
    public void testSelectPage(){

        Page<Post> postPage = new Page<>(1, 2);

        postMapper.selectPage(postPage,null);

        postPage.getRecords().stream().forEach(System.out::println);

    }
}
